package com.ssy.lingxi.order.controller.mobile;

import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.order.model.vo.mobile.request.MobileWechatAppletBindMemberOrderCountVO;
import com.ssy.lingxi.order.model.vo.mobile.response.MobileMemberSalesOrderCountQueryVO;
import com.ssy.lingxi.order.model.vo.mobile.response.MobileAchievementCountQueryVO;
import com.ssy.lingxi.order.model.vo.mobile.response.MobileMemberSalesCountQueryVO;
import com.ssy.lingxi.order.service.mobile.IMobileMemberSalesCountService;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @menu 微信小程序 - 业务员订单统计相关接口
 * @author 郑小翠
 * @version 2.02.18
 * @date 2022-03-24
 */
@RestController
@RequestMapping("/order/mobile/wechat/applet/member/sales")
public class MobileMemberSalesCountController {

    @Resource
    IMobileMemberSalesCountService orderCountService;

    /**
     * 业务员小程序 -首页 - 订单统计
     */
    @RequestMapping(value = "/index/count", method = RequestMethod.GET)
    public Wrapper<MobileMemberSalesOrderCountQueryVO> getOrderCountWechatApplet(@RequestHeader HttpHeaders headers) {
        return orderCountService.orderCountWechatApplet(headers);
    }

    /**
     * 业务员小程序 - 查看绑定会员
     */
    @RequestMapping(value = "/bind/count", method = RequestMethod.POST)
    public Wrapper<PageData<MobileMemberSalesCountQueryVO>> getBindMemberOrderCountWechatApplet(@RequestHeader HttpHeaders headers, @RequestBody @Valid MobileWechatAppletBindMemberOrderCountVO orderCountVO) {
        return orderCountService.bindMemberOrderCountWechatApplet(headers,orderCountVO);
    }

    /**
     * 业务员小程序 - 查看业务员个人业绩
     */
    @RequestMapping(value = "/personal/achievement", method = RequestMethod.GET)
    public Wrapper<PageData<MobileAchievementCountQueryVO>> getPersonalAchievement(@RequestHeader HttpHeaders headers, PageVO pageVO) {
        return orderCountService.personalAchievement(headers,pageVO);
    }
}
